<{include file="top.html" }>
</head>
<body>
<div class="xy-panel">
    <div class="xy-panel-content" style="bottom:0;">
        <div class="xy-row vDirectionRow">
            <form class="form-box" method="post" id="queryForm" action="<{U('shopConsume_queryResult')}>">
                <dl>
                    <input type="text" name="code" id="codeInput"  placeholder="请输入卡券号进行验证">
                </dl>
            </form>
            <div class="ui-button ui-button-2">
                <button id="query-btn">验证卡券</button>
            </div>
            <div class="ui-button ui-button-3" style="padding-top:0;">
                <button id="scan-btn">扫码核销</button>
            </div>
            <dl class="verification">
                <a href="<{U('shopConsume_log')}>">核销记录</a>
            </dl>
        </div>
    </div>
</div>
<script>
    $("#scan-btn").click(function(){scan();});
    $("#query-btn").click(function(){queryCode();});
    function scan(){
        wx.scanQRCode({
            needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
            scanType: ["qrCode"], // 可以指定扫二维码还是一维码，默认二者都有
            success: function (res) {
                var code = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                $('#codeInput').val(code);

            }
        });
    }
    function queryCode(){
        if($('#codeInput').val()==''){
            layer.msg("请指定卡券号",{time:1000})
            return;
        }
        $('#queryForm').submit();
    }

</script>
<{include file="signBody.html"}>

</body>
</html>